package com.robot.backend.controller.user;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.robot.backend.service.user.userHandleService;

import java.util.Map;

@RestController
@RequestMapping("/userHandle/")
public class userHandleController {

    @Autowired
        userHandleService userHandleService;

    @PostMapping("register/")
        public Map<String,String> register(@RequestParam Map<String,String> map){
            return userHandleService.registerInfo(map.get("name"), map.get("password"),map.get("email"));
    }
    @PostMapping("registerCode/")
        public Map<String,String> registerCode(@RequestParam Map<String,String> map){
        System.out.println(map);
            return userHandleService.registerCode(map.get("name"),map.get("password"),map.get("email"),map.get("code"));
    }
    @PostMapping("login/")
        public Map<String,String> login(@RequestParam Map<String,String> map){
            return userHandleService.login(map.get("email"), map.get("password"));
    }
    @PostMapping("forgetPassword/")
        public Map<String,String> forget(@RequestParam Map<String,String> map){
            return userHandleService.forgetPassword(map.get("name"),map.get("newPassword"),map.get("code"));
    }

}
